package com.mimosa.common.eucpsdk;

import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
/**
 * Client对象工厂类
 * @author wangchao
 *
 */
public class SingletonClient {
	private static Client client = null;

	private SingletonClient() {
	}

	public synchronized static Client getClient(String softwareSerialNo,
			String key, String password) {
		if (client == null) {
			try {
				client = new Client(softwareSerialNo, key, password);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return client;
	}

	public synchronized static Client getClient() {
		ResourceBundle bundle = PropertyResourceBundle.getBundle("config");
		if (client == null) {
			try {
				client = new Client(bundle.getString("softwareSerialNo"),
						bundle.getString("key"), bundle.getString("password"));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return client;
	}

}
